<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
<head>
<title>XML Transform Sample</title>
<link rel="stylesheet" type="text/css" href="../../../../docs/rotor.css">
</head>

<body>		


<h1> XML Transform Sample</h1>


<h2>Sample Overview</h2>


<p>This sample illustrates how to apply an Extensible Stylesheet Language 
Transformation (XSLT) file to an XML document using the <b>XslTransform</b> class. </p>


<p>This sample consists of a method, ReadTransformWrite, with two sections. The 
first part of the method simply reads an XML document and then transforms the 
data using an XSLT file. The second part reads an XML document, transforms the 
data, and then writes a new XML document from the transformed data. </p>


<p>The sample applies this method to three sets of documents: </p>
<ul>
  <li>The XML document books.xml and the 
  XSLT file books.xsl. The XSLT file consists of templates that get all the 
  books in the bookstore element and then, for each book element, get the values 
  for the ISBN attribute and the price element.</li>
  <li>The XML document 
  processparameters1.xml and the XSLT file stylesheetgenerator.xsl. The 
  XML in processparameters1.xml will cause a match with one template in the XSL 
  stylesheet and generate another stylesheet based on that match.</li>
  <li>The XML document 
  processparameters2.xml and the XSLT file stylesheetgenerator.xsl. The XML in 
  processparameters2.xml will cause a match with a different template in the 
  XSL stylesheet and generate a different stylesheet based on that match.</li>
</ul>


<h2>Sample Source and Build Output Locations</h2>


<p>The sample source is found in sscli20\samples\howto\xml\xmltransform.</p>


<p>The source file is:</p>


<ul class="none">
  <li><a href="xmltransform.cs">xmltransform.cs</a></li>
</ul>


<p>The other support files for this sample are:</p>


<ul class="none">
  <li><a href="books.xml">books.xml</a></li>
  <li><a href="books.xsl">books.xsl</a></li>
  <li><a href="processparameters1.xml">processparameters1.xml</a></li>
  <li><a href="processparameters2.xml">processparameters2.xml</a><br>
  <a href="stylesheetgenerator.xsl">stylesheetgenerator.xsl</a></li>
</ul>


<p>The build output location is %_NTTREE%\samples\xml\xmltransform.&nbsp; 
The output file is an executable assembly named xmltransform.exe.</p>


<h2>Building the Sample</h2>


<p>All samples are built from the buildall script.&nbsp;  </p>


<p>You can also build all the 
samples by switching to the root of the sample directory, sscli20\samples, and typing 
<code>build -c</code>.</p>


<p>You can build this specific sample  by switching to the sample directory and typing 
<code>build -c</code>.</p>


<h2>Running the Sample</h2>


<p>These steps require that the Shared Source CLI (SSCLI) be already built and 
functional.</p>


<ol>
  <li>Run  env.bat or source the env.csh or env.sh script files, depending on 
  your platform.</li>
  <li>Switch to the %_NTTREE%\samples\xml\xmltransform directory.</li>
  <li>Type the following command:<blockquote>


<p>clix xmltransform.exe</p>


  </blockquote>


  </li>
</ol>


<p>When the sample runs, several transformed XML files are 
generated:</p>


<ul class="none">
  <li>books_transform.xml</li>
  <li>processparameters1_transform.xml</li>
  <li>processparameters2_transform.xml</li>
</ul>


<hr>


<p><i>Copyright (c) 2006 Microsoft Corporation. All rights reserved.</i></p>
</body> 
</html>